#pragma once
#include "IPlugin.h"
#include <string>
#include <list>
#include <vector>
#include <map>

enum Type
{
	T_CPP2CS,
};

class CPlugin :
	public IPlugin
{
public:
	CPlugin(void);
	~CPlugin(void);

	virtual const char *Desc();
	virtual void ParseArgv(int nVar, char* argv[]);
	virtual bool Run();

private:
	void ParseConst(const std::string &path);
	void ParseMacro(const std::string &path);
	void ParseEnum(const std::string &path);
	void ParseStruct(const std::string &path);

private:
	struct MemberInfo
	{
		std::string strType;
		std::string strName;
		std::string strValue;
		std::string strDesc;
	};
	std::vector<MemberInfo> m_vecConstants;
	std::map<std::string, MemberInfo*> m_mapConstants;

	struct EnumeInfo
	{
		std::string strName;
		std::vector<MemberInfo> vecMemberInfo;
	};
	std::vector<EnumeInfo> m_vecEnums;

	struct StructInfo
	{
		std::string strID;
		std::string strName;
		std::string strParent;
		std::string strDesc;
		std::vector<MemberInfo> vecMemberInfo;
	};
	std::vector<StructInfo> m_vecStructs;

	std::string getNewType(const std::string &strType, bool isArray = false);

private:
	bool ExportCPP2CS();
	bool ExportMsgTypeCS();
	bool ExportMsgDefineCS();
	bool ExportMsgConstantCS();

private:
	Type m_nType;
	std::string m_strFromDir;
	std::string m_strOutDir;

	std::string m_strHeader;

	std::map<std::string, std::string> m_mapType;
};

